package edu.poly.game.util;

/**
 * Description: coordinate utility, contains x, y coordinate
 * Note: this object is immutable, once constructed should not be
 * 		 modified for code or logic safety
 * 
 * @author kevint
 */
public class Coordinate {
	private int XCoordinate;
	private int YCoordinate;

	/**
	 * Constructor
	 * @param x coordinate
	 * @param y coordinate
	 */
	public Coordinate(final int x, final int y) {
		this.XCoordinate = x;
		this.YCoordinate = y;
	}
	
	/**
	 * returns the x coordinate stored in this object
	 * @return x coordinate
	 */
	public int getXCoordinate() {
		return this.XCoordinate;
	}
	
	/**
	 * returns the y coordinate stored in this object
	 * @return y coordinate
	 */
	public int getYCoordinate() {
		return this.YCoordinate;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + XCoordinate;
		result = prime * result + YCoordinate;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) return false;
		Coordinate other = (Coordinate) obj;
		if (XCoordinate != other.XCoordinate) return false;
		if (YCoordinate != other.YCoordinate) return false;
		return true;
	}
}
